<%@page contentType="text/html" pageEncoding="UTF-8"%>
<%@taglib uri="/struts-tags" prefix="s"%>
<%@taglib uri="/struts-dojo-tags" prefix="sx"%>
<!DOCTYPE html>
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <title>SCA - Pesquisar Disciplinas</title>
    </head>
    <body>
        <h1>Pesquisar Disciplinas</h1>

        <s:form action="Disciplina">
            <fieldset style="width: 50%">
                <legend>Filtrar por:</legend>
                <table>
                    <tr>
                        <td>
                            Curso
                        </td>
                        <td>
                            <select id="curso" name="codCurso">
                                <option value="0">
                                    Todos
                                </option>
                                <s:iterator value="cursos">
                                    <option value="${codCurso}">
                                        ${nome}
                                    </option>
                                </s:iterator>
                            </select>
                        </td>

                        <td>
                            <s:textfield name="nomeDisciplina" label="Nome da Disciplina" ></s:textfield>
                        </td>

                        <td>
                            <s:submit action="pesquisarDisciplina" value="Pesquisar"></s:submit>
                            </td>

                        </tr>
                    </table>
                </fieldset>

                <br/>
                <table border="1">
                    <tr>
                        <th>
                            Cod. Disciplina
                        </th>

                        <th>
                            Nome Disciplina
                        </th>

                        <th colspan="2">
                            Ações
                        </th>
                    </tr>

                <s:iterator value="disciplinas">
                    <tr>
                        <td>
                            ${codDisciplina}
                        </td>

                        <td>
                            ${nome}
                        </td>

                        <td>
                            <s:url id="editarDisciplina" action="editarDisciplina">
                                <s:param name="codDisciplina" value="%{codDisciplina}"></s:param>
                            </s:url>
                            <s:a href="%{editarDisciplina}">Editar</s:a>
                            </td>
                            <td>
                            <s:url id="excluirDisciplina" action="excluirDisciplina">
                                <s:param name="codDisciplina" value="%{codDisciplina}"></s:param>
                            </s:url>
                            <s:a href="%{excluirDisciplina}">Excluir</s:a>
                            </td>
                        </tr>
                </s:iterator>
            </table>

            <table>
                <tr>

                    <td>
                        <s:submit action="voltarDisciplina" value="Voltar"></s:submit>
                        <s:submit action="incluirDisciplina" value="Incluir"></s:submit>

                    </td>
                </tr>
                </table>
        </s:form>
    </body>
</html>
